Skip to content

Scotland | ITP JAN-2026 | Tuan Nguyen | Sprint 3 | 1-Implement-and-rewrite-test#1259

Open
Jacknguyen4438 wants to merge 4 commits intoCodeYourFuture:mainfrom
Jacknguyen4438:Jest-test-case-sprint-3A
Open

Scotland | ITP JAN-2026 | Tuan Nguyen | Sprint 3 | 1-Implement-and-rewrite-test#1259
Jacknguyen4438 wants to merge 4 commits intoCodeYourFuture:mainfrom
Jacknguyen4438:Jest-test-case-sprint-3A

Conversation

@Jacknguyen4438
Copy link

Learners, PR Template

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Changelist

I have don't basic understand on how to correctly writing normal test and jest test frame work, I am waiting for this work to be review.

Questions

I have no question.

@Jacknguyen4438 Jacknguyen4438 changed the title Scotland | ITP JAN-2026 | Tuan Nguyen | Sprint 3 | 1- Implement-and-rewrite-test Scotland | ITP JAN-2026 | Tuan Nguyen | Sprint 3 | 1-Implement-and-rewrite-test Mar 13, 2026
@Jacknguyen4438 Jacknguyen4438 added 📅 Sprint 3 Assigned during Sprint 3 of this module Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Module-Structuring-And-Testing-Data The name of the module. labels Mar 13, 2026
Copy link
Contributor

@cjyuan cjyuan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Function implementation is correct.

Describing tests can be quite challenging. Feel free learn from AI how to keep the test descriptions concise.

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Mar 15, 2026
@Jacknguyen4438
Copy link
Author

@cjyuan Thank you for the review I have making change base on your PR review. It have been finish and ready to be reviewed again.

@Jacknguyen4438 Jacknguyen4438 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Mar 24, 2026
Comment on lines +42 to +45
let rank = card.slice(0,-1);
let suit = card.slice(-1);
if (
typeof card !== "string" ||
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • If card can be a non-string value, line 42 would have caused an error to be thrown before the type check on line 45.

  • If value of rank and suit won't change, it is better to declare them using const.

expect(getAngleType(359)).toEqual("Reflex angle");
});
// Case 6: Invalid angles
test(`should return "Invalid angle" when ( 0 < angle && angle > 360)`, () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The condition, ( 0 < angle && angle > 360), specified in the test description is not quite correct.
Hint: Check if the values you are testing meet the condition.

Comment on lines +20 to +22
test(`should return false when denominator is bigInt`, () => {
expect(isProperFraction(1, 23443243n)).toEqual(true);
});
Copy link
Contributor

@cjyuan cjyuan Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"bigint" is just a data type that can represent any integer, including small integers.

isProperFraction(10, 1n) should return false (if your function can handle "bigint" type value)

Comment on lines +23 to +25
test(`should return false when numerator is infinity`, () => {
expect(isProperFraction(23432434n, 10)).toEqual(false);
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

23432434n is not the same as infinity. Why test "bigint" type value at all?

});
test(`should return false when denominator < numerator`, () => {
expect(isProperFraction(1, -2)).toEqual(false);
});
Copy link
Contributor

@cjyuan cjyuan Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The conditions specified on line 14 and 17 are not how you decide whether a fraction is a proper fraction or not when one the values is negative.

Comment on lines +11 to +13
test(`should return false when numerator is zero`, () => {
expect(isProperFraction(0, 1)).toEqual(false);
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which source are you relying on for the definition of proper fraction?

Shouldn't zero be considered proper fraction?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Module-Structuring-And-Testing-Data The name of the module. Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Reviewed Volunteer to add when completing a review with trainee action still to take. 📅 Sprint 3 Assigned during Sprint 3 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants